<i><%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
	<!DOCTYPE html>
	<html>
<head>
<meta charset="UTF-8">
<title>公用分类表 编辑页面</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<jsp:include page="../com/header.jsp"></jsp:include>
<script type="text/javascript" src="../../js/comm/editcomm.js"></script>
<script type="text/javascript">
        $(function () {
            getDataById(root + 'cms/category/findShopCategoryById', "#shopCategoryTmpl", "#shopCategoryContent");
            $("#saveOrupdate").click(function () {
            	$("#categoryIcon").val(imgUrl);
            	$("#categorySelectIcon").val(imgUrl1);
            	if (!$('#shopCategoryContent').find('#categoryIcon').val()) {
					myAlert("请上传分类图标");
					return;
				}
				if (!$('#shopCategoryContent').find('#categorySelectIcon').val()) {
					myAlert("请上传分类选中图标");
					return;
				}
                saveData(root + 'cms/category/saveShopCategory', 'categoryList.jsp');
            });

            //上传分类图标
            $('#shopCategoryContent').on('click','#uploadPhotoFile', function () {
				upload("category");
	        });
	        
	        //上传分类选中图标
            $('#shopCategoryContent').on('click','#uploadPhotoFile1', function () {
				upload("category");
	        });

        });
    </script>
</head>
<body>
	<section>
		<div>
			<div class="col-xs-12">
				<div class="box" style="height:900px">
					<div class="box-header">
						<br> <input type="button" value="确定" id="saveOrupdate"
							class="btn btn-success"> <input type="button"
							onclick="backAction('categoryList.jsp');" class="btn btn-info"
							value="返回">
					</div>
					<form id="submit_form" class="form-horizontal"
						data-validator-option="{display: function(element){ return $(element).prev('label').text();}}">
						<div class="tab" id="shopCategoryContent"></div>
					</form>
				</div>
			</div>
		</div>
	</section>
	<script type="text/x-jsrender" id="shopCategoryTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">分类名称：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写分类名称" class="form-control input-sm" data-rule="分类名称:required;length[0~20]" id="categoryName" name="categoryName" value="{{:categoryName}}" />
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">类型：</label>
       				 <div class="col-md-3">
						<select class="form-control input-sm" id="type" name="type" data-rule="required" >
                          <option  value="">请选择</option>
                          <option  value="1" {{if type=="1"}}selected{{/if}}>商品</option>
                          <option  value="2" {{if type=="2"}}selected{{/if}}>资讯</option>
                        </select>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">分类图标：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
							{{if categoryIcon}}<img id="myImageShow" src="../../{{:categoryIcon}}" class="img" with="100px" height="100px">
                            {{else}}<img id="myImageShow" src="" width="100px" height="100px">{{/if}}
                            <input type="hidden" id="categoryIcon" name="categoryIcon" value="{{:categoryIcon}}"></input>
		                    <input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>
      		   <div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">分类选中图标：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
							{{if categorySelectIcon}}<img id="myImageShow1" src="../../{{:categorySelectIcon}}" class="img" with="100px" height="100px">
                            {{else}}<img id="myImageShow1" src="" width="100px" height="100px">{{/if}}
                            <input type="hidden" id="categorySelectIcon" name="categorySelectIcon" value="{{:categorySelectIcon}}"></input>
		                    <input type="file" id="uploadPhotoFile1" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">分类排序值：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写分类排序值" class="form-control input-sm" data-rule="分类排序值;required;length[0~8];plus" id="categoryOrder" name="categoryOrder" value="{{:categoryOrder}}" />
					</div>
      			</div>
			</fieldset>

</script>
</body>
	</html></i>